Termination w.r.t. Q of the following Term Rewriting System could be proven:

Q restricted rewrite system:
The TRS R consists of the following rules:

a__first(0, X) → nil
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
a__from(X) → cons(mark(X), from(s(X)))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(from(X)) → a__from(mark(X))
mark(0) → 0
mark(nil) → nil
mark(s(X)) → s(mark(X))
mark(cons(X1, X2)) → cons(mark(X1), X2)
a__first(X1, X2) → first(X1, X2)
a__from(X) → from(X)

Q is empty.


QTRS
  ↳ DependencyPairsProof

Q restricted rewrite system:
The TRS R consists of the following rules:

a__first(0, X) → nil
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
a__from(X) → cons(mark(X), from(s(X)))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(from(X)) → a__from(mark(X))
mark(0) → 0
mark(nil) → nil
mark(s(X)) → s(mark(X))
mark(cons(X1, X2)) → cons(mark(X1), X2)
a__first(X1, X2) → first(X1, X2)
a__from(X) → from(X)

Q is empty.

Using Dependency Pairs [1,15] we result in the following initial DP problem:
Q DP problem:
The TRS P consists of the following rules:

MARK(first(X1, X2)) → MARK(X1)
A__FIRST(s(X), cons(Y, Z)) → MARK(Y)
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(s(X)) → MARK(X)
MARK(cons(X1, X2)) → MARK(X1)
MARK(first(X1, X2)) → MARK(X2)
MARK(first(X1, X2)) → A__FIRST(mark(X1), mark(X2))
A__FROM(X) → MARK(X)

The TRS R consists of the following rules:

a__first(0, X) → nil
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
a__from(X) → cons(mark(X), from(s(X)))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(from(X)) → a__from(mark(X))
mark(0) → 0
mark(nil) → nil
mark(s(X)) → s(mark(X))
mark(cons(X1, X2)) → cons(mark(X1), X2)
a__first(X1, X2) → first(X1, X2)
a__from(X) → from(X)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.

↳ QTRS
  ↳ DependencyPairsProof
QDP
      ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

MARK(first(X1, X2)) → MARK(X1)
A__FIRST(s(X), cons(Y, Z)) → MARK(Y)
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(s(X)) → MARK(X)
MARK(cons(X1, X2)) → MARK(X1)
MARK(first(X1, X2)) → MARK(X2)
MARK(first(X1, X2)) → A__FIRST(mark(X1), mark(X2))
A__FROM(X) → MARK(X)

The TRS R consists of the following rules:

a__first(0, X) → nil
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
a__from(X) → cons(mark(X), from(s(X)))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(from(X)) → a__from(mark(X))
mark(0) → 0
mark(nil) → nil
mark(s(X)) → s(mark(X))
mark(cons(X1, X2)) → cons(mark(X1), X2)
a__first(X1, X2) → first(X1, X2)
a__from(X) → from(X)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


MARK(s(X)) → MARK(X)
The remaining pairs can at least be oriented weakly.

MARK(first(X1, X2)) → MARK(X1)
A__FIRST(s(X), cons(Y, Z)) → MARK(Y)
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(cons(X1, X2)) → MARK(X1)
MARK(first(X1, X2)) → MARK(X2)
MARK(first(X1, X2)) → A__FIRST(mark(X1), mark(X2))
A__FROM(X) → MARK(X)
Used ordering: Matrix interpretation [3]:
Non-tuple symbols:
M( a__first(x1, x2) ) =
/0\
\0/
+
/10\
\01/
·x1+
/10\
\11/
·x2

M( cons(x1, x2) ) =
/1\
\0/
+
/10\
\01/
·x1+
/00\
\00/
·x2

M( from(x1) ) =
/1\
\0/
+
/10\
\11/
·x1

M( mark(x1) ) =
/0\
\0/
+
/10\
\11/
·x1

M( s(x1) ) =
/1\
\1/
+
/10\
\01/
·x1

M( a__from(x1) ) =
/1\
\1/
+
/10\
\11/
·x1

M( 0 ) =
/1\
\0/

M( first(x1, x2) ) =
/0\
\0/
+
/10\
\01/
·x1+
/10\
\11/
·x2

M( nil ) =
/0\
\0/

Tuple symbols:
M( MARK(x1) ) = 0+
[0,1]
·x1

M( A__FROM(x1) ) = 0+
[0,1]
·x1

M( A__FIRST(x1, x2) ) = 0+
[0,0]
·x1+
[0,1]
·x2


Matrix type:
We used a basic matrix type which is not further parametrizeable.


As matrix orders are CE-compatible, we used usable rules w.r.t. argument filtering in the order.
The following usable rules [17] were oriented:

mark(s(X)) → s(mark(X))
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(0) → 0
mark(nil) → nil
a__first(X1, X2) → first(X1, X2)
a__from(X) → from(X)
a__first(0, X) → nil
a__from(X) → cons(mark(X), from(s(X)))
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
mark(from(X)) → a__from(mark(X))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ QDPOrderProof
QDP
          ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

MARK(first(X1, X2)) → MARK(X1)
A__FIRST(s(X), cons(Y, Z)) → MARK(Y)
MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(first(X1, X2)) → MARK(X2)
MARK(cons(X1, X2)) → MARK(X1)
A__FROM(X) → MARK(X)
MARK(first(X1, X2)) → A__FIRST(mark(X1), mark(X2))

The TRS R consists of the following rules:

a__first(0, X) → nil
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
a__from(X) → cons(mark(X), from(s(X)))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(from(X)) → a__from(mark(X))
mark(0) → 0
mark(nil) → nil
mark(s(X)) → s(mark(X))
mark(cons(X1, X2)) → cons(mark(X1), X2)
a__first(X1, X2) → first(X1, X2)
a__from(X) → from(X)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


MARK(first(X1, X2)) → MARK(X1)
A__FIRST(s(X), cons(Y, Z)) → MARK(Y)
MARK(first(X1, X2)) → MARK(X2)
MARK(first(X1, X2)) → A__FIRST(mark(X1), mark(X2))
The remaining pairs can at least be oriented weakly.

MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(cons(X1, X2)) → MARK(X1)
A__FROM(X) → MARK(X)
Used ordering: Polynomial interpretation [25]:

POL(0) = 1   
POL(A__FIRST(x1, x2)) = x1 + x2   
POL(A__FROM(x1)) = x1   
POL(MARK(x1)) = x1   
POL(a__first(x1, x2)) = 1 + x1 + x2   
POL(a__from(x1)) = x1   
POL(cons(x1, x2)) = x1   
POL(first(x1, x2)) = 1 + x1 + x2   
POL(from(x1)) = x1   
POL(mark(x1)) = x1   
POL(nil) = 1   
POL(s(x1)) = 1 + x1   

The following usable rules [17] were oriented:

mark(s(X)) → s(mark(X))
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(0) → 0
mark(nil) → nil
a__first(X1, X2) → first(X1, X2)
a__from(X) → from(X)
a__first(0, X) → nil
a__from(X) → cons(mark(X), from(s(X)))
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
mark(from(X)) → a__from(mark(X))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ QDPOrderProof
        ↳ QDP
          ↳ QDPOrderProof
QDP
              ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
MARK(cons(X1, X2)) → MARK(X1)
A__FROM(X) → MARK(X)

The TRS R consists of the following rules:

a__first(0, X) → nil
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
a__from(X) → cons(mark(X), from(s(X)))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(from(X)) → a__from(mark(X))
mark(0) → 0
mark(nil) → nil
mark(s(X)) → s(mark(X))
mark(cons(X1, X2)) → cons(mark(X1), X2)
a__first(X1, X2) → first(X1, X2)
a__from(X) → from(X)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


MARK(from(X)) → MARK(X)
MARK(from(X)) → A__FROM(mark(X))
The remaining pairs can at least be oriented weakly.

MARK(cons(X1, X2)) → MARK(X1)
A__FROM(X) → MARK(X)
Used ordering: Polynomial interpretation [25]:

POL(0) = 1   
POL(A__FROM(x1)) = 1 + x1   
POL(MARK(x1)) = 1 + x1   
POL(a__first(x1, x2)) = x1 + x2   
POL(a__from(x1)) = 1 + x1   
POL(cons(x1, x2)) = x1   
POL(first(x1, x2)) = x1 + x2   
POL(from(x1)) = 1 + x1   
POL(mark(x1)) = x1   
POL(nil) = 1   
POL(s(x1)) = 0   

The following usable rules [17] were oriented:

mark(s(X)) → s(mark(X))
mark(cons(X1, X2)) → cons(mark(X1), X2)
mark(0) → 0
mark(nil) → nil
a__first(X1, X2) → first(X1, X2)
a__from(X) → from(X)
a__first(0, X) → nil
a__from(X) → cons(mark(X), from(s(X)))
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
mark(from(X)) → a__from(mark(X))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ QDPOrderProof
        ↳ QDP
          ↳ QDPOrderProof
            ↳ QDP
              ↳ QDPOrderProof
QDP
                  ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

MARK(cons(X1, X2)) → MARK(X1)
A__FROM(X) → MARK(X)

The TRS R consists of the following rules:

a__first(0, X) → nil
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
a__from(X) → cons(mark(X), from(s(X)))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(from(X)) → a__from(mark(X))
mark(0) → 0
mark(nil) → nil
mark(s(X)) → s(mark(X))
mark(cons(X1, X2)) → cons(mark(X1), X2)
a__first(X1, X2) → first(X1, X2)
a__from(X) → from(X)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 1 SCC with 1 less node.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ QDPOrderProof
        ↳ QDP
          ↳ QDPOrderProof
            ↳ QDP
              ↳ QDPOrderProof
                ↳ QDP
                  ↳ DependencyGraphProof
QDP
                      ↳ UsableRulesProof

Q DP problem:
The TRS P consists of the following rules:

MARK(cons(X1, X2)) → MARK(X1)

The TRS R consists of the following rules:

a__first(0, X) → nil
a__first(s(X), cons(Y, Z)) → cons(mark(Y), first(X, Z))
a__from(X) → cons(mark(X), from(s(X)))
mark(first(X1, X2)) → a__first(mark(X1), mark(X2))
mark(from(X)) → a__from(mark(X))
mark(0) → 0
mark(nil) → nil
mark(s(X)) → s(mark(X))
mark(cons(X1, X2)) → cons(mark(X1), X2)
a__first(X1, X2) → first(X1, X2)
a__from(X) → from(X)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
We can use the usable rules and reduction pair processor [15] with the Ce-compatible extension of the polynomial order that maps every function symbol to the sum of its argument. Then, we can delete all non-usable rules [17] from R.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ QDPOrderProof
        ↳ QDP
          ↳ QDPOrderProof
            ↳ QDP
              ↳ QDPOrderProof
                ↳ QDP
                  ↳ DependencyGraphProof
                    ↳ QDP
                      ↳ UsableRulesProof
QDP
                          ↳ QDPSizeChangeProof

Q DP problem:
The TRS P consists of the following rules:

MARK(cons(X1, X2)) → MARK(X1)

R is empty.
Q is empty.
We have to consider all minimal (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs: